ubuntu20.04安装UHD(USRP Hardware Driver) v3.15 + GNURadio v3.8.1 (20200818) 您所在的位置:网站首页 心理学 文章 ubuntu20.04安装UHD(USRP Hardware Driver) v3.15 + GNURadio v3.8.1 (20200818)

ubuntu20.04安装UHD(USRP Hardware Driver) v3.15 + GNURadio v3.8.1 (20200818)

2024-01-09 21:31| 来源: 网络整理| 查看: 265

ubuntu20.04安装UHD(USRP Hardware Driver) v3.15 + GNURadio v3.8.1 (20200818)

本文主要参考: https://kb.ettus.com/Building_and_Installing_the_USRP_Open-Source_Toolchain_(UHD_and_GNU_Radio)_on_Linux

1 更新和安装依赖项

更新源:

sudo apt-get update

安装依赖项:

sudo apt-get -y install git swig cmake doxygen build-essential libboost-all-dev libtool libusb-1.0-0 libusb-1.0-0-dev libudev-dev libncurses5-dev libfftw3-bin libfftw3-dev libfftw3-doc libcppunit-1.15-0 libcppunit-dev libcppunit-doc ncurses-bin cpufrequtils python-numpy python-numpy-doc python-numpy-dbg python3-scipy python-docutils qt4-bin-dbg qt4-default qt4-doc libqt4-dev libqt4-dev-bin python-qt4 python-qt4-dbg python-qt4-dev python-qt4-doc python-qt4-doc libqwt6abi1 libfftw3-bin libfftw3-dev libfftw3-doc ncurses-bin libncurses5 libncurses5-dev libncurses5-dbg libfontconfig1-dev libxrender-dev libpulse-dev swig g++ automake autoconf libtool python-dev libfftw3-dev libcppunit-dev libboost-all-dev libusb-dev libusb-1.0-0-dev fort77 libsdl1.2-dev python-wxgtk3.0 git libqt4-dev python-numpy ccache python-opengl libgsl-dev python-cheetah python-mako python-lxml doxygen qt4-default qt4-dev-tools libusb-1.0-0-dev libqwtplot3d-qt5-dev pyqt4-dev-tools python-qwt5-qt4 cmake git wget libxi-dev gtk2-engines-pixbuf r-base-dev python-tk liborc-0.4-0 liborc-0.4-dev libasound2-dev python-gtk2 libzmq3-dev libzmq5 python-requests python-sphinx libcomedi-dev python-zmq libqwt-dev libqwt6abi1 python-six libgps-dev libgps23 gpsd gpsd-clients python-gps python-setuptools 2 下载UHD代码库并编译安装 2.1 下载

新建工作目录并克隆代码

cd $HOME mkdir workarea cd workarea git clone https://github.com/EttusResearch/uhd

此处遭遇下载失败,经过多番搜索和尝试,认为根本原因是由于连接速度太慢(通常不超过20k/s),解决方法是利用 gitee 码云从github导入代码库,再从 gitee 克隆到本地,1.8M/s的下载速度,完美解决。

2.2 检出标签

进入代码库路径

cd uhd

查看标签

$ git tag -l ... release_003_009_004 release_003_009_005 release_003_010_000_000

检出v3.15.0.0版本

git checkout v3.15.0.0 2.3 编译

新建build目录,并编译

cd host mkdir build cd build cmake ../ make

此处报错,提示找不到 setuptools ,于是再次安装 python3 setuptools

sudo apt-get install python3-setuptools

再次编译顺利通过。

可通过make test检查编译结果:

$ make test Running tests... Test project /home/zxhui/workspace/uhd/host/build Start 1: addr_test 1/50 Test #1: addr_test ........................ Passed 0.05 sec Start 2: buffer_test 2/50 Test #2: buffer_test ...................... Passed 0.03 sec Start 3: byteswap_test 3/50 Test #3: byteswap_test .................... Passed 0.01 sec Start 4: cast_test 4/50 Test #4: cast_test ........................ Passed 0.01 sec Start 5: chdr_test 5/50 Test #5: chdr_test ........................ Passed 0.02 sec Start 6: constrained_device_args_test 6/50 Test #6: constrained_device_args_test ..... Passed 0.01 sec Start 7: convert_test 7/50 Test #7: convert_test ..................... Passed 0.11 sec Start 8: dict_test 8/50 Test #8: dict_test ........................ Passed 0.02 sec Start 9: eeprom_utils_test 9/50 Test #9: eeprom_utils_test ................ Passed 0.01 sec Start 10: error_test 10/50 Test #10: error_test ....................... Passed 0.01 sec Start 11: fp_compare_delta_test 11/50 Test #11: fp_compare_delta_test ............ Passed 0.01 sec Start 12: fp_compare_epsilon_test 12/50 Test #12: fp_compare_epsilon_test .......... Passed 0.01 sec Start 13: gain_group_test 13/50 Test #13: gain_group_test .................. Passed 0.02 sec Start 14: isatty_test 14/50 Test #14: isatty_test ...................... Passed 0.01 sec Start 15: log_test 15/50 Test #15: log_test ......................... Passed 0.01 sec Start 16: math_test 16/50 Test #16: math_test ........................ Passed 0.01 sec Start 17: narrow_cast_test 17/50 Test #17: narrow_cast_test ................. Passed 0.01 sec Start 18: property_test 18/50 Test #18: property_test .................... Passed 0.02 sec Start 19: ranges_test 19/50 Test #19: ranges_test ...................... Passed 0.01 sec Start 20: scope_exit_test 20/50 Test #20: scope_exit_test .................. Passed 0.01 sec Start 21: sid_t_test 21/50 Test #21: sid_t_test ....................... Passed 0.01 sec Start 22: sensors_test 22/50 Test #22: sensors_test ..................... Passed 0.01 sec Start 23: soft_reg_test 23/50 Test #23: soft_reg_test .................... Passed 0.01 sec Start 24: sph_recv_test 24/50 Test #24: sph_recv_test .................... Passed 0.02 sec Start 25: sph_send_test 25/50 Test #25: sph_send_test .................... Passed 0.02 sec Start 26: subdev_spec_test 26/50 Test #26: subdev_spec_test ................. Passed 0.01 sec Start 27: time_spec_test 27/50 Test #27: time_spec_test ................... Passed 0.02 sec Start 28: tasks_test 28/50 Test #28: tasks_test ....................... Passed 0.32 sec Start 29: vrt_test 29/50 Test #29: vrt_test ......................... Passed 0.02 sec Start 30: expert_test 30/50 Test #30: expert_test ...................... Passed 0.02 sec Start 31: fe_conn_test 31/50 Test #31: fe_conn_test ..................... Passed 0.01 sec Start 32: block_id_test 32/50 Test #32: block_id_test .................... Passed 0.01 sec Start 33: blockdef_test 33/50 Test #33: blockdef_test .................... Passed 0.03 sec Start 34: device3_test 34/50 Test #34: device3_test ..................... Passed 0.20 sec Start 35: graph_search_test 35/50 Test #35: graph_search_test ................ Passed 0.02 sec Start 36: node_connect_test 36/50 Test #36: node_connect_test ................ Passed 0.02 sec Start 37: rate_node_test 37/50 Test #37: rate_node_test ................... Passed 0.02 sec Start 38: stream_sig_test 38/50 Test #38: stream_sig_test .................. Passed 0.02 sec Start 39: tick_node_test 39/50 Test #39: tick_node_test ................... Passed 0.01 sec Start 40: eeprom_c_test 40/50 Test #40: eeprom_c_test .................... Passed 0.01 sec Start 41: error_c_test 41/50 Test #41: error_c_test ..................... Passed 0.02 sec Start 42: ranges_c_test 42/50 Test #42: ranges_c_test .................... Passed 0.01 sec Start 43: sensors_c_test 43/50 Test #43: sensors_c_test ................... Passed 0.01 sec Start 44: string_vector_c_test 44/50 Test #44: string_vector_c_test ............. Passed 0.01 sec Start 45: subdev_spec_c_test 45/50 Test #45: subdev_spec_c_test ............... Passed 0.01 sec Start 46: nocscript_expr_test 46/50 Test #46: nocscript_expr_test .............. Passed 0.02 sec Start 47: nocscript_ftable_test 47/50 Test #47: nocscript_ftable_test ............ Passed 0.02 sec Start 48: nocscript_parser_test 48/50 Test #48: nocscript_parser_test ............ Passed 0.02 sec Start 49: config_parser_test 49/50 Test #49: config_parser_test ............... Passed 0.02 sec Start 50: paths_test 50/50 Test #50: paths_test ....................... Passed 0.01 sec 100% tests passed, 0 tests failed out of 50 Total Test time (real) = 1.40 sec 2.4 安装

以下是安装过程:

sudo make install sudo ldconfig

在 $HOME/.bashrc 文件中最后一行添加环境变量

export LD_LIBRARY_PATH=/usr/local/lib

关闭终端,重启生效,此时安装完毕。

2.5 检查确认

可在没有硬件的情况下通过以下命令检查安装是否正确,若正确将得到类似结果

$ uhd_find_devices [INFO] [UHD] linux; GNU C++ version 9.3.0; Boost_107100; UHD_3.15.0.HEAD-0-gaea0e2de No UHD Devices Found 2.6 下载FPGA镜像文件

通过以下命令下载UHD FPGA 镜像文件

sudo uhd_images_downloader

此处报错:

[ERROR] Downloader raised an unhandled exception: HTTPConnectionPool(host='files.ettus.com', port=80): Max retries exceeded with url: /binaries/cache/x3xx/fpga-fde2a94eb/x3xx_x310_fpga_default-gfde2a94e.zip (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 110] Connection timed out')) You can run this again with the '--verbose' flag to see more information If the problem persists, please email the output to: [email protected]

待解决…

3 安装GNURadio 3.8.1 3.1 二进制安装

官网推荐直接二进制安装:

sudo add-apt-repository ppa:gnuradio/gnuradio-releases sudo apt-get update sudo apt-get install gnuradio 3.2 源码编译安装

如果确有需要,可以使用源码编译安装。

3.2.1 安装依赖项

对具有Python 3支持的GNU Radio v3.8.x,安装以下依赖项:

sudo apt install git cmake g++ libboost-all-dev libgmp-dev swig python3-numpy \ python3-mako python3-sphinx python3-lxml doxygen libfftw3-dev \ libsdl1.2-dev libgsl-dev libqwt-qt5-dev libqt5opengl5-dev python3-pyqt5 \ liblog4cpp5-dev libzmq3-dev python3-yaml python3-click python3-click-plugins \ python3-zmq python3-scipy python3-gi python3-gi-cairo gobject-introspection gir1.2-gtk-3.0

若要安装开发版 (GNU Radio v3.9)则还需要以下依赖项:

sudo apt install pybind11-dev python3-matplotlib 3.2.2 安装Volk

volk(vector optimized library of kernel)是矢量优化库,它可以提高在不同计算平台矢量计算的效率。

Volk项目也是GNURADIO的一个子项目,GNURADIO也依赖这个项目。

cd ~/ git clone https://github.com/gnuradio/volk.git cd volk mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python3 ../ make make test sudo make install sudo ldconfig 3.2.3 安装 GNU Radio cd git clone https://github.com/gnuradio/gnuradio.git cd gnuradio git submodule update --init --recursive mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python3 ../ make

下载速度太慢的话可以从gitee下载,用以下地址替代 github 克隆地址: https://gitee.com/crown_zxh/gnuradio.git

检查编译结果并安装:

make test sudo make install 3.2.4 配置连接库环境变量

添加如下环境变量到 $HOME/.bashrc 文件的最末行

export PYTHONPATH=/usr/local/lib/python3/dist-packages:/usr/local/lib/python3/site-packages 3.3 安装完毕

关闭终端重新打开,输入

gnuradio-companion

开启你的新旅程吧!



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有